Skip to content

PG-2029 Meson support#531

Merged
jeltz merged 9 commits intopercona:mainfrom
jeltz:meson
Apr 8, 2026
Merged

PG-2029 Meson support#531
jeltz merged 9 commits intopercona:mainfrom
jeltz:meson

Conversation

@jeltz
Copy link
Copy Markdown
Collaborator

@jeltz jeltz commented Mar 15, 2026

Meson gives a more modern development experience while making some features easier to implement in the future. This Meson file calls pg_config directly to get the paths but does not get any of the compiler flags from pg_config.

This PR moves the CI to use Meson but since the build and QA teams need extra time to migrate to Meson we keep the makefile and add a new CI job which checks so we do not break it.

Please tell me if this PR is too big and should be split for ease of review.

Pros:

  • More modern development experience
  • Makes it easier for us if we want to set our own code style with own warnings
  • Parallel TAP tests
  • We can use basically the same code for C++ projects like pg_oidc_validator
  • Easier to add Windows support (maybe a downside 😨)

Cons:

  • We need to re-implement platform support ourselves in some cases since we no longer can use the Makefile.{plaform} files
  • Maybe we still need a simple makefile for PGXN compat, but that is not an issue for pg_tde but for our other extensions that is an issue

@jeltz jeltz force-pushed the meson branch 15 times, most recently from 8ddfd65 to 786f289 Compare March 16, 2026 08:10
@jeltz jeltz changed the title Expermintal Meson support PG-2029 Expermintal Meson support Mar 16, 2026
@jeltz jeltz force-pushed the meson branch 14 times, most recently from 04a1ef9 to a54e804 Compare March 19, 2026 09:13
@jeltz jeltz changed the title PG-2029 Experimental Meson support PG-2029 Meson support Mar 30, 2026
@jeltz jeltz force-pushed the meson branch 12 times, most recently from ef9d6ce to 4b74f89 Compare April 2, 2026 09:51
Copy link
Copy Markdown
Collaborator

@AndersAstrand AndersAstrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! It looks really good :)

I'm a bit confused by the commit message to the Add support for pg_regress tests in Meson commit. There is no install added anywhere as far as I can see?

I'm not sure the last commit belong in this PR at all, but yeah. Contributing.md definitely needs updating or removing.

Spelling:

First commit message:
expereince->experience * 2

Second commit message:
amke -> make

Sixth commit message:
There is an extra "this" here: "Also this apparently this fixed"

Ninth commit message:
Meosn -> Meson

May I suggest echo set spell >> .vimrc? 😜

Comment thread meson.build Outdated
Comment thread meson.build
'-fexcess-precision=standard',
]), language: ['c'])

# TODO: Why does it seems like they sometimes are in pkglibdir and other times in libdir?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because there are some shenanigans going on with cross compilation I think.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly but I do not understand it. Would it be ok to merge this without understanding or should I investigate this before we merge the PR?

Comment thread meson.build
Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Collaborator

@AndersAstrand AndersAstrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the Makefile just invoke meson after this if we need make for a little longer?

jeltz added 7 commits April 7, 2026 14:55
To give a more modern development experience we plan to replace our
current make and PGXS based build system with one which uses Meson and
pg_config to achieve the same thing.

Potential advantages:

- More modern and pleasant experience
- Parallel tests
- Allows for Windows support

Potential disadvantages:

- We may have to manually implement support for odd platforms
This is split out from the previous commit to make the history easier to
read and the commits easier to review.
One of the weird things with the Meson tests for pg_tde is that they are
actually install tests so we need to manually run meson install before
running meson test.
One of the nice advantages of meson is that test can be run in parallel
which we now can take advantage of.
Based on Makefile.darwin in the PostgreSQL project.
Since we plan to only support Meson builds in the future let's move all
of our CI jobs over to using Meson. For simplicty we put the build
directory outside of the git repository. Also this apparently fixed a
bug in our code formatting job for the frotnend tools so let's also
commit the changed formatting.

Disable the test timeout in meson since the default timeout is an issue
when running with sanitizers.
While we are moving our development builds and CI directly from make to
Meson our QA farm and packaging needs more time to migrate to Meson, so
to make sure our make file does not break we add a simple CI job which
builds pg_tde using make and then runs the test cases.
@jeltz
Copy link
Copy Markdown
Collaborator Author

jeltz commented Apr 7, 2026

Given that the reason that we are keeping make is because the build engineers are very busy right now I do not think it is an option to try to rewrite the makefile to wrap meson. Things could break then. Maybe as a next step when things have calmed down for them. But in that case we may not even need to keep it around at all.

Comment thread CONTRIBUTING.md Outdated
@AndersAstrand
Copy link
Copy Markdown
Collaborator

Given that the reason that we are keeping make is because the build engineers are very busy right now I do not think it is an option to try to rewrite the makefile to wrap meson. Things could break then. Maybe as a next step when things have calmed down for them. But in that case we may not even need to keep it around at all.

We'll also need to inform them of the move of t/results

The instructions are still wrong after this but I did some quick
corrections to even be able to update it for adding Meson support.
@jeltz
Copy link
Copy Markdown
Collaborator Author

jeltz commented Apr 7, 2026

We'll also need to inform them of the move of t/results

Not due to this PR. That was intended for a separate PR. And accidentally left in by me. Lifted it out now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants